-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix url encoder by specifying allowed characters #51
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice fix 👍 Some comments inline, let me know what you think 🙂
Sources/Navigator.swift
Outdated
@@ -1,4 +1,8 @@ | |||
import Foundation | |||
#if os(OSX) | |||
import Cocoa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come this is needed, since you have only removed code from this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I added it by mistake. Will remove it
Sources/Utilities.swift
Outdated
@@ -0,0 +1,25 @@ | |||
import Foundation | |||
|
|||
struct Utilities { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest using a different name than Utilities
(which is both very ambiguous, and tends to be a "catch all" for all kinds of unrelated APIs). Since these utilities are all about encoding strings, how about implementing them in an extension on String
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ironically 😛 I just moved those from string extensions to a new class. I had some problem before when some frameworks have the same method on String
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's a valid point. In that case, how about a StringEncoder
class or something like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I can add that
Sources/Utilities.swift
Outdated
|
||
/// Perform url encoding | ||
/// | ||
/// - Parameter string: The source string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document parameter allowed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I'd name that parameter allowedCharacters
, since just allowed
is a bit ambiguous in this context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also why not just pass a CharacterSet
, just like to String
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, I will add that
delimiter
Utilities
to do encoding. Also covered by tests 😎 . Run on Xcode 8 and Xcode 9open(url)
methods, as they are internal now